<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AdminLoopRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|max:50|min:4',
            'loop_pic' => 'required|image',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '轮播图的名字不可以为空哦！',
            'name.max'      => '轮播图的名字最大为50位哦！',
            'name.min'      =>  '轮播图的名字最小为4位哦！',
            'loop_pic.required' => '没有图片被上传',
            'loop_pic.image' => '上传的文件不是一张图片',    
        ];
    }
}
